#-*-coding:utf-8-*-
import csv
import json


csvfile = open('data/002.csv','r');
jsonfile = open('data/002.log','w');

#fieldnames = ('LineId', 'Date', 'Time', 'EventId', '');
fieldnames = csvfile.readline().strip('\n').split(',')
#print fieldnames
reader = csv.DictReader(csvfile, fieldnames)
i = 0
for row in reader:
    # str.decode('UTF-8')
    #print str
    if i >= 300:
        break
    #row['EventId'] = row['EventId'].replace('E', '')
    #print row['EventId']
    json.dump(row, jsonfile)
    #json.dump(str, jsonfile)
    jsonfile.write('\n')
    i += 1
# for row in reader:
#     json.dump(row, jsonfile)
#     jsonfile.write('\n')
